﻿using System.Collections.Generic;

namespace Laugh.Data.DatabaseCfg
{
    public class DatabasePublisher : IDatabasePublisher
    {
        private IEnumerable<IDatabase> _databases;
        private ISessionFactoryHolder _sessionFactoryHolder;

        public DatabasePublisher(IEnumerable<IDatabase> databases, ISessionFactoryHolder sessionFactoryHolder)
        {
            _databases = databases;
            _sessionFactoryHolder = sessionFactoryHolder;
        }

        public void Register()
        {
            _databases.Each(c => c.Register(_sessionFactoryHolder));
        }
    }
}
